﻿using System;

//抽象属性
namespace Runoob2 {
    public abstract class Person {
        public abstract string Name { get; set; }
        public abstract int Age { get; set; }
    }

    class Student : Person {
        // 声明自动实现的属性
        public string Code { get; set; } = "N.A";
        //事项抽象类的属性
        public override string Name { get; set; } = "N.A";
        public override int Age { get; set; } = 0;

        public override string ToString() {
            return $"Code = {Code}, Name = {Name}, Age = {Age}";
        }
    }

    class ExampleDemo {
        public static void Main() {
            // 创建一个新的 Student 对象
            Student s = new Student {
                Code = "001",
                Name = "Zara",
                Age = 9
            };

            Console.WriteLine("Student Info:- {0}", s);

            // 增加年龄
            s.Age += 1;
            Console.WriteLine("Student Info:- {0}", s);

            Console.ReadKey();
        }
    }
}